package com.wude.guild.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.wude.guild.R;

/**
 * Created by Administrator on 2017/11/23 0023.
 */

public class MineMenuAdapter extends BaseAdapter {
    private String[] names = new String[]{"绑币管理", "账户充值", "我的礼包", "我的积分", "我的游戏", "我的收藏", "我的评论", "我的流量", "推荐给好友", "问题与建议", "关于我们"};
    private int[] icons = new int[]{R.mipmap.bangbi, R.mipmap.chongzhi, R.mipmap.libao, R.mipmap.jifen, R.mipmap.game, R.mipmap.shoucang, R.mipmap.pinglun,
            R.mipmap.liuliang, R.mipmap.shape, R.mipmap.wenti, R.mipmap.aboutus,};
    private Context context;

    public MineMenuAdapter(Context context) {
        super();
        this.context = context;
    }

    @Override
    public int getCount() {
        return names.length;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null)
            view = LayoutInflater.from(context).inflate(R.layout.mine_menu_item, viewGroup, false);
        ImageView iv_icon = view.findViewById(R.id.iv_icon);
        TextView tv_name = view.findViewById(R.id.tv_name);
        View bigView = view.findViewById(R.id.bigView);
        View lineView = view.findViewById(R.id.lineView);

        iv_icon.setImageResource(icons[i]);
        tv_name.setText(names[i]);
        if (i % 4 == 3 && i != names.length - 1) {
            lineView.setVisibility(View.GONE);
            bigView.setVisibility(View.VISIBLE);
        } else {
            lineView.setVisibility(View.VISIBLE);
            bigView.setVisibility(View.GONE);
        }
        if (i == names.length - 1) {
            lineView.setVisibility(View.GONE);
        }
        return view;
    }
}
